package com.ask.dao;

import com.ask.domain.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
public interface BookDao {
    @Insert("insert into book values(null,#{name},#{type},#{description})")
    public void save(Book book);
    @Update("update book set name=#{name},type=#{type},description=#{description} where id=#{id}")
    public void update (Book book);
    @Delete("delete from book where id = #{id}")
    public void delete(Integer id);
    @Select("select * from book where id = #{id}")
    public Book findById(Integer id);
    @Select("select * from book")
    public List<Book> getAllBooks();
}
